package com.ecoolex.hotel.saas.ws;

import java.util.List;

import org.apache.dubbo.config.annotation.Service;
import org.springframework.beans.factory.annotation.Autowired;

import com.ecoolex.framework.common.exception.BizException;
import com.ecoolex.framework.common.pojo.Page;
import com.ecoolex.framework.common.pojo.Pagination;
import com.ecoolex.hotel.saas.core.manager.DepartmentManager;
import com.ecoolex.hotel.saas.core.manager.OutletsManager;
import com.ecoolex.hotel.saas.core.manager.StoreBrandManager;
import com.ecoolex.hotel.saas.core.manager.StoreManager;
import com.ecoolex.hotel.saas.core.manager.StoreOrderConfigManager;
import com.ecoolex.hotel.saas.core.manager.StoreWeixinConfigManager;
import com.ecoolex.hotel.saas.entity.Department;
import com.ecoolex.hotel.saas.entity.Outlets;
import com.ecoolex.hotel.saas.entity.Store;
import com.ecoolex.hotel.saas.entity.StoreBrand;
import com.ecoolex.hotel.saas.entity.StoreOrderConfig;
import com.ecoolex.hotel.saas.entity.StoreWeixinConfig;
import com.ecoolex.hotel.saas.pojo.EditStoreOrderConfigDTO;
import com.ecoolex.hotel.saas.pojo.EditStoreStep;
import com.ecoolex.hotel.saas.pojo.EditStoreWeixinConfigDTO;
import com.ecoolex.hotel.saas.pojo.QueryStoreDTO;
import com.ecoolex.hotel.saas.pojo.StoreLicense;

@Service
public class StoreServiceImpl implements StoreService{
	
	@Autowired
	private StoreBrandManager storeBrandManager;

	@Override
	public Pagination<StoreBrand> queryStoreBrand(String name, Page page) {
		return storeBrandManager.query(name, page);
	}

	@Override
	public StoreBrand getStoreBrand(Integer brandId) {
		return storeBrandManager.get(brandId);
	}

	@Override
	public StoreBrand addStoreBrand(StoreBrand record, String createUser) throws BizException {
		return storeBrandManager.add(record, createUser);
	}

	@Override
	public StoreBrand editStoreBrand(StoreBrand record, String updateUser) throws BizException {
		return storeBrandManager.edit(record, updateUser);
	}

	@Override
	public Boolean delStoreBrand(StoreBrand record, String updateUser) throws BizException {
		return storeBrandManager.del(record, updateUser);
	}

	@Autowired
	private StoreManager storeManager;
	
	@Override
	public Pagination<Store> queryStore(QueryStoreDTO query, StoreLicense license, Page page) {
		return storeManager.queryStore(query, license, page);
	}

	@Override
	public Store getStore(Integer storeId) {
		return storeManager.getStore(storeId);
	}

	@Override
	public Store updateStoreStep(EditStoreStep step, String updateUser) throws BizException {
		return storeManager.updateStoreStep(step, updateUser);
	}

	@Override
	public Boolean delStore(Store record, String updateUser) throws BizException {
		return storeManager.delStore(record, updateUser);
	}

	@Override
	public Store onlineStore(Store store, String updateUser) throws BizException {
		return storeManager.onlineStore(store, updateUser);
	}

	@Override
	public Store offlineStore(Store store, String updateUser) throws BizException {
		return storeManager.offlineStore(store, updateUser);
	}

	@Autowired
	private DepartmentManager departmentManager;
	
	@Override
	public Department getDepartment(Integer departmentId, Integer storeId) {
		return departmentManager.getDepartment(departmentId, storeId);
	}
	
	@Override
	public Department getDepartment(Integer departmentId) {
		return departmentManager.getDepartment(departmentId);
	}

	@Override
	public Pagination<Department> queryDepartment(String name, Integer storeId, Page page) {
		return departmentManager.query(name, storeId, page);
	}

	@Override
	public Department addDepartment(Department record, String createUser) throws BizException {
		return departmentManager.addDepartment(record, createUser);
	}

	@Override
	public Department editDepartment(Department record, String updateUser) throws BizException {
		return departmentManager.editDepartment(record, updateUser);
	}

	@Override
	public Boolean delDepartment(Department record, String updateUser) throws BizException {
		return departmentManager.delDepartment(record, updateUser);
	}

	@Override
	public List<Department> queryDepartmentByOutletsId(Integer outletsId) {
		return departmentManager.queryDepartmentByOutletsId(outletsId);
	}
	
	@Autowired
	private OutletsManager outletsManager;

	@Override
	public Outlets getOutlets(Integer outletsId, Integer storeId) {
		return outletsManager.getOutlets(outletsId, storeId);
	}

	@Override
	public Pagination<Outlets> queryOutlets(String name, Integer storeId, Page page) {
		return outletsManager.queryOutlets(name, storeId, page);
	}

	@Override
	public Outlets addOutlets(Outlets add, List<Integer> departmentIdList, String createUser) throws BizException {
		return outletsManager.addOutlets(add, departmentIdList, createUser);
	}

	@Override
	public Outlets editOutlets(Outlets edit, List<Integer> departmentIdList, String updateUser) throws BizException {
		return outletsManager.editOutlets(edit, departmentIdList, updateUser);
	}

	@Override
	public Boolean delOutlets(Outlets edit, String updateUser) throws BizException {
		return outletsManager.delOutlets(edit, updateUser);
	}

	@Autowired
	private StoreOrderConfigManager storeOrderConfigManager;
	
	@Override
	public StoreOrderConfig getStoreOrderConfig(Integer storeId) {
		return storeOrderConfigManager.getStoreOrderConfig(storeId);
	}

	@Override
	public StoreOrderConfig editStoreOrderConfig(EditStoreOrderConfigDTO edit, String updateUser) throws BizException {
		return storeOrderConfigManager.editStoreOrderConfig(edit, updateUser);
	}
	
	@Autowired
	private StoreWeixinConfigManager storeWeixinConfigManager;

	@Override
	public StoreWeixinConfig getStoreWeixinConfig(Integer storeId) {
		return storeWeixinConfigManager.getStoreWeixinConfig(storeId);
	}

	@Override
	public StoreWeixinConfig editStoreWeixinConfig(EditStoreWeixinConfigDTO edit, String updateUser) throws BizException {
		return storeWeixinConfigManager.editStoreWeixinConfig(edit, updateUser);
	}

}
